package com.exam.scjp5.objectives.section_1;

class Parent
{
    // Some implementation here.
}

class Child extends Parent
{
    
}

/**
 * Here is the abstract class.
 */
abstract class ExampleAbstractClass
{
    protected abstract Parent method1(Parent p);
}

/**
 * This will extend abstract class.
 */
class SubClass1 extends ExampleAbstractClass
{
    public Parent method1(Parent p)
    {
        return null;
    }
}


/**
 * This will also extend abstract class.
 */
class SubClass2 extends ExampleAbstractClass
{
    /**
     * ERROR! Here, child must implement abstract method and 
     * its method's parameters are must be same as parent's.
     */
    public Parent method1(Child c) // ERROR! Require 'method1(Parent p)'
    {
        return null;
    }
}


/**
 * This will also extend abstract class.
 */
class SubClass3 extends ExampleAbstractClass
/**
 * can declare : 'abstract class SubClass3' also here 
 * because any abstract class can have NO abstract methods.
 */
{
    /**
     * OK! Here, although different return type, it's ok.
     * It is just because of covariant return type.
     */
    public Child method1(Parent p) 
    {
        return null;
    }
}


/**
 * This will also extend abstract class.
 */
abstract class SubClass4 extends ExampleAbstractClass
{
    // This is abstract class. So, no need to implement parent's abstract methods.
}